package com.slm.report.view.data;

import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;

import com.slm.report.databinding.ViewEditContentBinding;

/**
 * @ProjectName: My Application
 * @Package: com.slm.report.view.data
 * @ClassName: EditeContentView
 * @Description: java类作用描述
 * @Author: 王丹丹
 * @CreateDate: 2020/6/1 9:39
 * @UpdateUser: 更新者
 * @UpdateDate: 2020/6/1 9:39
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class EditContentView extends BaseContentView {

    ViewEditContentBinding viewEditContentBinding = null;

    public EditContentView(Context context) {
        super(context);
        viewEditContentBinding = ViewEditContentBinding.inflate(LayoutInflater.from(getContext()), this, true);
        viewEditContentBinding.contentTv.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                String content = s.toString();
                contentDataBean.setContent(content);
            }

            @Override
            public void afterTextChanged(Editable s) {

            }
        });
    }


    @Override
    void upDataContent() {
        viewEditContentBinding.titleTv.setText(contentDataBean.getTitleStr());

        viewEditContentBinding.contentTv.setText(contentDataBean.getContent());
        if (isEdit) {
            viewEditContentBinding.contentTv.setHint("请填写" + contentDataBean.getTitleStr());
        } else {
            viewEditContentBinding.contentTv.setFocusable(false);
            viewEditContentBinding.contentTv.setFocusableInTouchMode(false);
        }

    }


}
